package com.zzyl.serve.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/member/orders/project")
public class MemberOrdersController extends BaseController {
    @Autowired
    private INursingProjectService nursingProjectService;
    /**
     * 分页查询护理项目列表
     */
    @GetMapping("/page")
    @ApiOperation("分页查询护理项目列表")
    public TableDataInfo getByPage(
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
            @RequestParam(value = "status", required = false) Integer status
    ){
        startPage();
        List<NursingProject> nursingProject = nursingProjectService.selectPage(pageNum, pageSize, name, status);
        return getDataTable(nursingProject);
    }

    /**
     * 获取护理项目详细信息
     */
    @GetMapping("{id}")
    @ApiOperation("根据编号查询护理项目信息")
    public AjaxResult getById(@PathVariable Long id) {
        NursingProject nursingProject = nursingProjectService.getById(id);
        return AjaxResult.success(nursingProject);
    }
}